package flink_p2_sql

import org.apache.flink.streaming.api.scala.StreamExecutionEnvironment
import org.apache.flink.table.api.{EnvironmentSettings, TableEnvironment}
import org.apache.flink.table.api.scala.StreamTableEnvironment

object tableApi01_TableEnv {


  /**
   * 两种创建Table Env的方式
   * @param args
   */
  def main(args: Array[String]): Unit = {



    val streamEnv: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment

    /**
     * 第一种创建方法
     */
    val tableEnv1: StreamTableEnvironment = StreamTableEnvironment.create(streamEnv)


    /**
     * 第二种创建方法
     */
    val settings: EnvironmentSettings = EnvironmentSettings.newInstance()
      .useBlinkPlanner() //使用blink
      .inStreamingMode() //是否用于流计算
      .build()

    val tableEnv2: StreamTableEnvironment = StreamTableEnvironment.create(streamEnv, settings)



  }
}
